package com.adong.demo;
import com.adong.config.SpringConfig;
import com.adong.service.impl.UserServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author com.adong
 */
public class UserDemo {
   @Test
    public void show(){
        ApplicationContext app = new ClassPathXmlApplicationContext("Bean.xml");
        UserServiceImpl userServiceImpl = app.getBean("userServiceImpl", UserServiceImpl.class);
        userServiceImpl.save();
    }
    @Test
    public void show2(){
        ApplicationContext app = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserServiceImpl userServiceImpl = app.getBean("userServiceImpl", UserServiceImpl.class);
        userServiceImpl.save();
    }

}
